<template>
  <!-- // 表格列弹出的筛选框 -->
  <el-table-column :prop="prop" v-bind="$attrs" :width="width" :column-key="columnKey">
    <template #header>
      <el-popover v-model:visible="state.visible" placement="bottom" :width="240">
        <template #reference>
          <span class="header_filtering" @click="state.visible=true">
            {{ label }}
            <svg-icon  icon-class="header_filtering" />
          </span>
        </template>
        <div class="filter-container">
          <div class="header">
            <div class="header-left">
              <svg-icon icon-class="screen" />筛选
            </div>
            <div class="header-right">
              <svg-icon class="icon" icon-class="header_filtering" />
            </div>
          </div>
          <div class="content">
            <div class="content_input">
              <el-input placeholder="搜索字段" prefix-icon="el-icon-search" />
            </div>
            <el-checkbox-group v-model="state.checkList">
              <el-checkbox label="复选框 A" />
              <el-checkbox label="复选框 B" />
              <el-checkbox label="复选框 C" />
            </el-checkbox-group>
          </div>
          <div class="footer">
            <el-button size="small" @click="state.visible = false">取消</el-button>
            <el-button size="small" type="primary" @click="handleSubmit">确定</el-button>
          </div>
        </div>
      </el-popover>
    </template>
  </el-table-column>
</template>

<script lang="ts" setup>
import {  PropType, reactive, toRefs, watch } from 'vue'

  const props=defineProps({
    prop: {
      type: String,
      default: ''
    },
    width: {
      type: String || Number,
      default: ''
    },
    type: {
      type: String,
      default: ''
    },
    index: {
      type: Number,
      default: 0
    },
    columnKey: {
      type: String,
      default: ''
    },
    label: {
      type: String,
      default: ''
    },
    item: {
      type: String,
      default: ''
    },
    minWidth: {
      type: String || Number,
      default: ''
    },
    fixed: {
      type: String || Boolean,
      default: ''
    }
  })
  const emit=defineEmits(['check'])
    const handleSubmit = () => {
      state.visible = false
    }
    const state = reactive({
      visible: false,
      checkList: []
    })
    watch(
      () => state.checkList,
      (n, o) => {
        // emit('check', state.checkList)
      }
    )
   
  

</script>

<style lang="scss" scoped>
.header_filtering{
&:hover{
   cursor: pointer;
}
}
.iconStyle {
  margin-left: 4px;
}
.icon {
  margin-bottom: 3px;
  &:hover {
    cursor: pointer;
  }
}
.filter-container {
  margin: 8px;
  width: 200px;
  .header,
  .footer {
    height: 44px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .content {
    .content_input {
      width: 200px;
      margin: auto;
      height: 44px;
    }
    ::v-deep(.el-checkbox) {
      width: 200px;
      height: 44px;
      line-height: 44px;
    }
  }
}
</style>
